package barbershop.com.controller;

import barbershop.com.entity.ServiceType;
import barbershop.com.service.ServiceTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/serviceType")
public class ServiceTypeController {
    @Autowired
    private ServiceTypeService serviceTypeService;

    @RequestMapping("/add")
    public ServiceType addServiceType(@RequestBody ServiceType serviceType){
        return this.serviceTypeService.insert(serviceType);
    }

    @RequestMapping("/delete")
    public Boolean deleteServiceType(@RequestBody ServiceType serviceType){
        return this.serviceTypeService.delete(serviceType);
    }

    @RequestMapping("/update")
    public ServiceType updateServiceType(@RequestBody ServiceType serviceType){
        return this.serviceTypeService.update(serviceType);
    }

    @RequestMapping("/find")
    public ServiceType findServiceType(@RequestBody ServiceType serviceType){
        return this.serviceTypeService.find(serviceType);
    }

    @RequestMapping("/findAll")
    public List<ServiceType> findAllServiceType(){
        return this.serviceTypeService.findAll();
    }
}
